package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.domain.SpotDetail;
import cn.wolfcode.wolf2w.domain.Strategy;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.service.ISpotDetailService;
import cn.wolfcode.wolf2w.service.IStrategyService;
import cn.wolfcode.wolf2w.service.ITravelService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("index")
public class IndexController {
    @Autowired
    private ISpotDetailService spotDetailService;
    @Autowired
    private IBannerService bannerService;
    @Autowired
    private ITravelService travelService;
    @Autowired
    private IStrategyService strategyService;

    @GetMapping("/banners/travel")
    public Object detail() {
        //游记banner，前面5个
        List<Banner> list = bannerService.queryFive();
        //返回
        return JsonResult.success(list);
    }

    @GetMapping("/banners/strategy")
    public Object strategy() {
        //攻略,最火的
        Strategy strategy = strategyService.getForFirst();
        //返回
        return JsonResult.success(strategy);
    }


}
